package cn.zqh.brand.client;


import cn.zqh.bean.api.CommonResult;
import cn.zqh.bean.bo.AdminChangeCommodity;
import cn.zqh.bean.bo.Commodity;
import cn.zqh.bean.bo.EsCommodity;
import cn.zqh.brand.config.DefaultFeignConfiguration;

import cn.zqh.brand.interceptor.FeignInterceptor;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.io.IOException;

@Component
@FeignClient(value = "bs-commodity",configuration = { DefaultFeignConfiguration.class, FeignInterceptor.class})
public interface CommodityClient {


    /**
     * @Author: zqh
     * @Date:
     * @Description: 根据id查询商品
     */
    @ApiOperation(value = "根据id查询商品")
    @GetMapping(value = "/commodity/getCommodityById")
    public EsCommodity getCommodityById(@RequestParam String id );


    /**
     * @Author: zqh
     * @Date:
     * @Description: 修改商品信息基于管理员
     */
    @ApiOperation(value = "管理员修改商品信息")
    @PostMapping(value = "/commodity/ModifyTheProductInformationBasedOnTheAdministrator")
    public String ModifyTheProductInformationBasedOnTheAdministrator(@RequestBody AdminChangeCommodity adminChangeCommodity)throws IOException;

    /**
     * @Author: zqh
     * @Date:
     * @Description: 通过商品信息获取商品信息，不是返回es数据库的信息
     */
    @ApiOperation(value = "根据id查询商品（不是返回es数据库的信息）")
    @GetMapping(value = "/commodity/getfoodsById")
    public Commodity gCommodity(@RequestParam("id") String id);

    /**
     * @Author: zqh
     * @Date:
     * @Description: 更改商品库存
     */
    @ApiOperation(value = "更改商品库存(放行)")
    @PostMapping(value = "/commodity/changeItemInventory")
    public String changeItemInventory(@RequestParam("commodityId") String commodityId, @RequestParam("number") Integer number)throws IOException;
}
